home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / ease-3.5 / src / fixstrings.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-16  |  2.0 KB  |  100 lines

  1. /*
  2.  * $Revision: 2.2 $
  3.  * Check-in $Date: 1991/05/16 10:45:25 $
  4.  *
  5.  * $Author: barnett $
  6.  *
  7.  * $Log: fixstrings.c,v $
  8.  * Revision 2.2  1991/05/16  10:45:25  barnett
  9.  * Better support for System V machines
  10.  * Support for machines with read only text segments
  11.  *
  12.  * Revision 2.1  1990/01/30  14:25:14  jeff
  13.  * Comment changes only.
  14.  *
  15.  * Revision 2.0  88/06/15  14:41:19  root
  16.  * Baseline release for net posting. ADR.
  17.  * 
  18.  * Version 1.2  87/02/25  16:55:13  jeff
  19.  * Add RCS header lines.  No code changes.
  20.  * 
  21.  */
  22. #ifdef FLUKE
  23. # ifndef LINT
  24.     static char RCSid[] = "@(#)FLUKE  $Header: /home/kreskin/u0/barnett/Src/ease/src/RCS/fixstrings.c,v 2.2 1991/05/16 10:45:25 barnett Exp $";
  25. # endif LINT
  26. #endif FLUKE
  27.  
  28. /*  FLUKE jps 16-apr-86 - special hacks for NULL pointers.
  29.  *
  30.  *  The author of ease used a *lot* of NULL pointers.  This isn't much
  31.  *  of a problem on a vax, where NULL pointers look like "".  Not so on a Sun.
  32.  *
  33.  *  We hack around the problem by defining a set of wrappers for the
  34.  *  standard string functions, making it appear as though they accept NULL
  35.  *  pointers.  In the other C files, cpp macros are used to revector the
  36.  *  standard string functions to this file.
  37.  */
  38. #ifdef SYSV
  39. #include <string.h>
  40. #define index strchr
  41. #define rindex strrchr
  42. #else
  43. #include <strings.h>
  44. #endif
  45. #define fix(s) ((s) ? (s) : "")
  46.  
  47. char *Xstrcat (s1, s2)
  48. char *s1, *s2; 
  49. {
  50.     return (strcat (s1, fix (s2)));
  51. }
  52.  
  53. char *Xstrncat (s1, s2, n)
  54. char *s1, *s2; 
  55. {
  56.     return (strncat (s1, fix (s2), n));
  57. }
  58.  
  59. Xstrcmp (s1, s2)
  60. char *s1, *s2; 
  61. {
  62.     return (strcmp (fix (s1), fix (s2)));
  63. }
  64.  
  65. Xstrncmp (s1, s2, n)
  66. char *s1, *s2; 
  67. {
  68.     return (strncmp (fix (s1), fix (s2), n));
  69. }
  70.  
  71. char *Xstrcpy (s1, s2)
  72. char *s1, *s2; 
  73. {
  74.     return (strcpy (s1, fix (s2)));
  75. }
  76.  
  77. char *Xstrncpy (s1, s2, n)
  78. char *s1, *s2; 
  79. {
  80.     return (strncpy (s1, fix (s2), n));
  81. }
  82.  
  83. Xstrlen (s)
  84. char *s; 
  85. {
  86.     return (strlen (fix (s)));
  87. }
  88.  
  89. char *Xindex (s, c)
  90. char *s, c; 
  91. {
  92.     return (index (fix (s), c));
  93. }
  94.  
  95. char *Xrindex (s, c)
  96. char *s, c; 
  97. {
  98.     return (rindex (fix (s), c));
  99. }
  100.